//
// Created by Semir on 2020/5/25.
//

#include <iostream>
#include <set>
#include <map>
#include <deque>
#include <string>

using namespace std;

map<char, int> charSet;
deque<char> Q;
char target = '#';

void Insert(char ch) {
    if (target == '#') {
        target = ch;
        charSet[ch] = 1;
        Q.push_back(ch);
    } else if (charSet.count(ch) < 1) {
        charSet[ch] = 1;
        Q.push_back(ch);
    } else {
        charSet[ch]++;
        Q.push_back(ch);
        if (ch == target) {
            while (charSet[target] > 1 && !Q.empty()) {
                Q.pop_front();
                target = Q.empty() ? '#' : Q.front();
            }
        }
    }

}

char FirstAppearingOnce() {
    return Q.empty() ? '#' : target;
}

int main() {
    string str = "google";
    for (char c : str) {
        Insert(c);
    }
    char res = FirstAppearingOnce();
    cout << res << endl;
    return 0;
}